package se.webbzon.boltzmann.game.object.player.rootsie;

import se.webbzon.boltzmann.game.character.CharacterException;
import se.webbzon.boltzmann.game.object.camera.GameCamera;
import se.webbzon.boltzmann.game.object.player.AbstractPlayerCharacter;
import se.webbzon.boltzmann.player.Player;
import se.webbzon.boltzmann.player.RootsieCharacter;
import se.webbzon.oschi01.worldarea.WorldArea;

public class RootsiePlayerCharacter extends AbstractPlayerCharacter {

	// The current earthquake
	Earthquake earthquake;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public RootsiePlayerCharacter(Player player, RootsieCharacter rootsie)
			throws CharacterException {
		super(player, rootsie);
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	@Override public int getFootstepCooldown() {
		return -1;
	}

	@Override public double getJumpSpeed() {
		return 5;
	}
	
	@Override public double getGroundSpeed() {
		return 1.5;
	}
	
	@Override public double getAirSpeed() {
		return 0.15;
	}

	@Override public double getWaterSpeed() {
		return 0.8;
	}

	@Override public double getFocusSpeed() {
		return 0.01;
	}

	@Override public void onFocusBegin() {
		final WorldArea world = getWorld();
		final GameCamera camera = 
				world.findInstances(GameCamera.class).iterator().next();
		earthquake = new Earthquake(this,camera);
		world.createInstance(earthquake);
	}

	@Override public void onFocusEnd() {
		earthquake.release(getWorld());
	}

}
